allFuncs["OpenWidgetBox"] = function() {
	if ($('getwidgetlink').innerHTML=='Get a Vote for me Widget.') $('getwidgetlink').innerHTML = 'Close';
	else $('getwidgetlink').innerHTML = 'Get a Vote for me Widget.';
	new Effect.toggle('widgetbox', 'slide');
	return false;
}

allFuncs["SubmitVote"] = function() {
	var valid = new Validation('votefrm', {immediate:true});
	if (valid.validate()) {
		new Ajax.Request(self.location+'?ajax=1', {
			parameters: $('votefrm').serialize(true), 
			onLoading: function() { $('vote-loading').toggle('appear'); },
			onComplete: function() { $('vote-loading').toggle('appear'); },
			onSuccess: function(transport) { $('results-flash').innerHTML = transport.responseText; },
			onFailure: function(transport) { $('results-flash').innerHTML = " Ajax Request Failed "; }
		});
	}
	return false;
}
